package com.jingdianjichi.user.controller;

import com.jingdianjichi.redis.util.GuavaCacheUtil;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @Create 2024/7/7 12:34
 */
@RestController("/guava")
public class guavaCache {
    @Resource
    private GuavaCacheUtil guavaCacheUtil;


    public void test1() {
      List<Long> skuList =new ArrayList<>();
        guavaCacheUtil.getResult(skuList, "skuInfo",
                "skuName", skuInfo.class, (list)->{
                    Map<Long, skuInfo> skuNameMap = getSkuName(skuList);
                    return skuNameMap;
                });
        guavaCacheUtil.getResult(skuList, "skuInfo",
                "skuPrice", skuInfo.class, (list)->{
                    Map<Long, skuPriceInfo> skuNameMap = getSkuPrice(skuList);
                    return skuNameMap;
                });

    }
    public Map<Long,skuInfo> getSkuName(List<Long> skuIds) {
         return Collections.emptyMap();
    }
    public Map<Long,skuPriceInfo> getSkuPrice(List<Long> skuIds) {
        return Collections.emptyMap();
    }

    class skuInfo{
        private Long id;
        private String name;
    }
    class skuPriceInfo{
        private Long id;
        private String price;
    }
}
